  class Cadastro::Contato::FederacaosController < ApplicationController
  # GET /federacao
  # GET /federacao.xml
  def index
    @federacaos = Federacao.find(:all).paginate :page => params[:pagina], :per_page => 15
    @situacoes = Situacao.find(:all)
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @federacaos }
    end
  end

  # GET /federacao/1
  # GET /federacao/1.xml
  def show
    @federacao = Federacao.find(params[:id])
    @situacoes = Situacao.find(:all)
    @field_disable = true
    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @federacao }
    end
  end

  # GET /federacao/new
  # GET /federacao/new.xml
  def new
    @federacao = Federacao.new
    @field_disable = false
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @federacao }
    end
  end

  # GET /federacao/1/edit
  def edit
    @federacao = Federacao.find(params[:id])
    @field_disable = false
  end

  # POST /federacao
  # POST /federacao.xml
  def create
    @federacao = Federacao.new(params[:federacao])
    respond_to do |format|
      if @federacao.save
        flash[:success] = 'Federação criada com sucesso.'
        format.html { redirect_to(@federacao) }
        format.xml  { render :xml => @federacao, :status => :created, :location => @federacao }
      else
        format.html { render :action => "new"}
        format.xml  { render :xml => @federacao.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /federacao/1
  # PUT /federacao/1.xml
  def update
    @federacao = Federacao.find(params[:id])
    respond_to do |format|
      if @federacao.update_attributes(params[:federacao])
        flash[:success] = 'Federação atualizada com sucesso.'
        format.html { redirect_to(@federacao) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @federacao.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /federacao/1
  # DELETE /federacao/1.xml
  def destroy
    @federacao = Federacao.find(params[:id])
    respond_to do |format|
        if @federacao.destroy
            flash[:success] = 'Federação excluída com sucesso.'
            format.html { redirect_to(federacaos_path ) }
            format.xml  { head :ok }
        end
    end
  end
end